function getUrlParam(name) {
    var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
    if (reg.test(window.location.href)) {
        return unescape(RegExp.$2.replace(/\+/g, " "))
    } else {
        return false;
    }
}

$(function () {

    var s = getUrlParam("studentId");
    if (getUrlParam("studentId")) {
        $.ajax({
            url: "/getOne",
            type: 'Post',
            data: {studentId: getUrlParam("studentId")},
            // contentType: false,
            // processData: false,
            // cache: false,
            success: function (data) {

                $("input[name='name']").val(data.data.name);
                $("input[name='studentId']").val(data.data.studentId);
                $("input[name='age']").val(data.data.age);
                $("input[name='grade']").val(data.data.grade);
                $("input[name='department']").val(data.data.department);
                $("input[name='major']").val(data.data.major);
                $("input[name='idCard']").val(data.data.idCard);
                $("input[name='schooling']").val(data.data.schooling);
                $("input[name='phone']").val(data.data.phone);

                layui.use(['form', 'layedit', 'laydate'], function() {
                    var form = layui.form
                        , layer = layui.layer
                        , layedit = layui.layedit
                        , laydate = layui.laydate;


                    form.val('example', {
                        "nation":data.data.nation,
                        "sex": data.data.sex,
                        "pay": data.data.pay,
                        "start": data.data.start
                    })

                });



            }
        });
    }
})